const router = require("koa-router")();

router.get("/doLogin", async ctx => {
    /**username=cheng   pwd=123456 */
    var { username, pwd } = ctx.query;
    if(username == "cheng" && pwd == "123456"){
        ctx.cookies.set("login","success");
        await ctx.redirect("/home");
    }else{
        ctx.body = "<script>alert('用户名或密码错误');location.href='/login'</script>"
    }
})

module.exports = router;